﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ListView.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Scrollbars.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Buttons.xaml" />

        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Calendar.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.CheckBox.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ComboBox.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ContextMenu.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.DatePicker.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.DataGrid.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.GroupBox.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ListBox.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.PasswordBox.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ProgressBar.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.RadioButton.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Slider.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TabControl.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TextBlock.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TextBox.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Label.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Tooltip.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ToolBar.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TreeView.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.GridSplitter.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <ControlTemplate x:Key="ValidationToolTipTemplate">
        <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
            <Grid.RenderTransform>
                <TranslateTransform x:Name="xform" X="-25" />
            </Grid.RenderTransform>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="OpenStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0" />
                        <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
                                    <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root">
                                    <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualTransition>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Closed">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root">
                                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Open">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
                                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root">
                                <SplineDoubleKeyFrame KeyTime="0" Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border Background="{DynamicResource ValidationBrush1}" CornerRadius="5" Margin="4,4,-4,-4" />
            <Border Background="{DynamicResource ValidationBrush2}" CornerRadius="4" Margin="3,3,-3,-3" />
            <Border Background="{DynamicResource ValidationBrush3}" CornerRadius="3" Margin="2,2,-2,-2" />
            <Border Background="{DynamicResource ValidationBrush4}" CornerRadius="2" Margin="1,1,-1,-1" />
            <Border Background="{DynamicResource ValidationBrush5}" CornerRadius="2" /> 
            <Border CornerRadius="2">
                <TextBlock Foreground="{DynamicResource WhiteColorBrush}"
                           MaxWidth="250"
                           Margin="8,4,8,4"
                           TextWrapping="Wrap"
                           Text="{Binding (Validation.Errors)[0].ErrorContent}"
                           UseLayoutRounding="false" />
            </Border>
        </Grid>
    </ControlTemplate>

    <Style x:Key="MetroToggleSwitch" TargetType="{x:Type Controls:ToggleSwitch}" BasedOn="{StaticResource {x:Type Controls:ToggleSwitch}}" />

    <Style TargetType="ToolTip" BasedOn="{StaticResource MetroToolTip}" />
    <Style TargetType="Button" BasedOn="{StaticResource MetroButton}" />
    <Style TargetType="ToggleButton" BasedOn="{StaticResource MetroToggleButton}" />
    <Style TargetType="TextBox" BasedOn="{StaticResource MetroTextBox}" />
    <Style TargetType="Slider" BasedOn="{StaticResource MetroSlider}" />
    <Style TargetType="TextBlock" BasedOn="{StaticResource MetroTextBlock}" />
    <Style TargetType="Label" BasedOn="{StaticResource MetroLabel}" />
    <Style TargetType="TabItem" BasedOn="{StaticResource MetroTabItem}"  />
    <Style TargetType="TabControl" BasedOn="{StaticResource MetroTabControl}" />
    <Style TargetType="ScrollBar" BasedOn="{StaticResource MetroScrollBar}" />
    <Style TargetType="RadioButton" BasedOn="{StaticResource MetroRadioButton}" />
    <Style TargetType="ProgressBar" BasedOn="{StaticResource MetroProgressBar}" />
    <Style TargetType="PasswordBox" BasedOn="{StaticResource MetroPasswordBox}" />
    <Style TargetType="CheckBox" BasedOn="{StaticResource MetroCheckBox}" />
    <Style TargetType="ComboBox" BasedOn="{StaticResource MetroComboBox}" />
    <Style TargetType="ComboBoxItem" BasedOn="{StaticResource MetroComboBoxItem}" />
    <Style TargetType="Separator" BasedOn="{StaticResource MetroSeparator}" />
    <Style TargetType="MenuItem" BasedOn="{StaticResource MetroMenuItem}" />
    <Style TargetType="Menu" BasedOn="{StaticResource StandardMenu}" />
    <Style TargetType="ContextMenu" BasedOn="{StaticResource MetroContextMenu}" />
    <Style TargetType="GroupBox" BasedOn="{StaticResource MetroGroupBox}" />
    <Style TargetType="ListBox" BasedOn="{StaticResource MetroListBox}" />
    <Style TargetType="ListBoxItem" BasedOn="{StaticResource MetroListBoxItem}" />
    <Style TargetType="ListView" BasedOn="{StaticResource MetroListView}" />
    <Style TargetType="ListViewItem" BasedOn="{StaticResource MetroListViewItem}" />
    <Style TargetType="DatePicker" BasedOn="{StaticResource MetroDatePicker}"/>
    <Style TargetType="DatePickerTextBox" BasedOn="{StaticResource MetroDatePickerTextBox}"/>
    <Style TargetType="Calendar" BasedOn="{StaticResource MetroCalendar}" />
    <Style TargetType="DataGrid" BasedOn="{StaticResource MetroDataGrid}" />
    <Style TargetType="TreeView" BasedOn="{StaticResource MetroTreeView}" />
    <Style TargetType="GridSplitter" BasedOn="{StaticResource MetroGridSplitter}" />

    <Style TargetType="{x:Type ScrollViewer}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid x:Name="Grid" Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
                        <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
                        <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>